import request from "../request.js";


//请求前缀
const PREFIXs = "/ikeaOrder";

const PREFIX = "http://192.168.6.195:9527/ikea";



export function findBoard(params) {
  return request({
    //模板字符串拼接参数
    url: `${PREFIX}/dist/findBoard`,
    method: "GET",
    params: params,
  })
}


export function findOrderList(roleName) {
  return request({
    //模板字符串拼接参数
    url: `${PREFIX}/ikeaOrder/findOrderList`,
    method: "GET",
    params: roleName,
  })
}


export function findAllOrderListPage(roleName) {
  return request({
    //模板字符串拼接参数
    url: `${PREFIX}/ikeaOrder/findAllOrderListPage`,
    method: "GET",
    params: roleName,
  })
}


//获取所有订单
export function findikeaAllOrderMsg(roleName) {
  return request({
    //模板字符串拼接参数
    url: `${PREFIX}/ikeaOrderMsg/findAllOrderListPage`,
    method: "GET",
    params: roleName,
  })
}

export function findAllOrderById(id) {
  return request({
    //模板字符串拼接参数
    url: `${PREFIX}/ikeaOrder/findAllOrderById?number=` + id,
    method: "GET",
  })
}

export function findOrderDetailsById(id) {
  return request({
    //模板字符串拼接参数
    url: `${PREFIX}/ikeaOrderMsg/findOrderDetailsById?id=` + id,
    method: "GET",
  })
}

export function findCancelOrderListPage(roleName) {
  return request({
    //模板字符串拼接参数
    url: `${PREFIX}/ikeaOrder/findCancelOrderListPage`,
    method: "GET",
    params: roleName,
  })
}




export function getDispatchingById(id) {
  return request({
    //模板字符串拼接参数
    url: `${PREFIX}/dist/getDispatchingById?id=` + id,
    method: "GET"
  })
}

//撤销派工
export function getDispatchingRevokeById(id) {
  return request({
    //模板字符串拼接参数
    url: `${PREFIX}/dist/getDispatchingRevokeById?id=` + id,
    method: "GET"
  })
}

//完成配送
export function getDispatchingComplete(id, orderId) {
  return request({
    //模板字符串拼接参数
    url: `${PREFIX}/dist/getDispatchingComplete?id=` + id + '&orderId=' + orderId,
    method: "GET"
  })
}

/**
 * 获取派工列表信息
 */

export function findDispatchingList(roleName) {
  return request({
    //模板字符串拼接参数
    url: `${PREFIX}/ikeaOrderMsg/findDispatchingList`,
    method: "GET",
    params: roleName,
  })
}

/**
 * 获取派工列表信息统计
 */

export function findCount(roleName) {
  return request({
    //模板字符串拼接参数
    url: `${PREFIX}/dist/findCount`,
    method: "GET",
    params: roleName,
  })
}

/**
 * 新建派工
 */
export function findDispatchingSave(data) {
  return request({
    //模板字符串拼接参数
    url: `${PREFIX}/dist/findDispatchingSave`,
    method: "POST",
    data: data,
  })
}

/**
 * 查询派工
 * @param {*} roleName 
 * @returns 
 */
export function getDispatching(roleName) {
  return request({
    //模板字符串拼接参数
    url: `${PREFIX}/dist/getDispatching`,
    method: "GET",
    params: roleName,
  })
}
//更新派工车组信息
export function findUpdateCarPer(roleName) {
  return request({
    //模板字符串拼接参数
    url: `${PREFIX}/dist/findUpdateCarPer`,
    method: "POST",
    data: roleName,
  })
}


//加派车组信息
export function findDispatchingAddSave(roleName) {
  return request({
    //模板字符串拼接参数
    url: `${PREFIX}/dist/findDispatchingAddSave`,
    method: "POST",
    data: roleName,
  })
}

export function findPlanningList(roleName) {
  return request({
    //模板字符串拼接参数
    url: `${PREFIX}/plannig/getPageList`,
    method: "GET",
    params: roleName,
  })
}

export function PlanningSave(data) {
  return request({
    //模板字符串拼接参数
    url: `${PREFIX}/plannig/save`,
    method: "POST",
    data: data,
  })
}



export function findPersonnelList(roleName) {
  return request({
    //模板字符串拼接参数
    url: `${PREFIX}/dist/findPersonnel`,
    method: "GET",
    params: roleName,
  })
}

export function findCarList(roleName) {
  return request({
    //模板字符串拼接参数
    url: `${PREFIX}/dist/findCarList`,
    method: "GET",
    params: roleName,
  })
}


//获取车辆系统车辆信息
export function getCarList(params) {
  return request({
    //模板字符串拼接参数
    url: `${PREFIX}/ikeaCar/getCarList`,
    method: "GET",
    params: params,
  })
}

export function getCarPerList(params) {
  return request({
    //模板字符串拼接参数
    url: `${PREFIX}/ikeaCar/getCarPerList`,
    method: "GET",
    params: params,
  })
}
export function saveCar(data) {
  return request({
    //模板字符串拼接参数
    url: `${PREFIX}/ikeaCar/saveCar`,
    method: "POST",
    data: data
  })
}